<?php
require_once("myheader.php");
require_once("myfooter.php");
require_once("helper/connexion.php");
require_once("helper/enseignement_helper.php");
myHeader("enseignements");
connexion_sql();
?>

<div id="body">
<h2>Enseignements</h2>
<div class="accordion" id="accordion">
<?php
$req = getFormation();
$i=0;
while($row = pg_fetch_assoc($req)){
?>
<div class="accordion-group">
  <div class="accordion-heading">
    <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapse<?php echo $i; ?>"><?php echo $row["nomformation"]; ?></a>
  </div>
  <div id="collapse<?php echo $i; ?>" class="accordion-body collapse" style="height: 0px">
    <div class="accordion-inner">
         
			  <?php
			  $req2 = getOption( $row["idformation"]);
			  while($rowOption = pg_fetch_assoc($req2)){
			  ?> 
			  <div class="tabbable tabs-left">
				  
				  <ul class="nav nav-tabs">
					<li><h4><?php echo $rowOption['nomoption'];?></h4>
					 <p>Groupes :  <span class="badge badge-info"><?php echo $rowOption['nbgroupestd'];?></span></p>
					 <p>Promotion : <span class="badge badge-warning">8</span></p>
					 <a class="label label-success" href="modifier_option.php?id=<?php echo $rowOption['idoption']; ?>">Modifier</a> 
					 <a class="label label-important" href="supprimer_option.php?id=<?php echo $rowOption['idoption']; ?>">Supprimer</a>
					<li>
				  </ul>
				  
				  <div class="tab-content"> 
						   
						  
						 

							<table class="table table-striped">
							   
							   
							    <thead>
								<tr>
								<th>Enseignement</th>
								<th>Code</th>
								<th>Date Début</th>
								<th>Date Fin</th>
								</tr>
								</thead>
								<tbody>

									<?php
									  $req3 = getEnseignement($row["idformation"],$rowOption["idoption"]);
									  while($rowEnseignement = pg_fetch_assoc($req3)){
									?>
							    <tr>
								<td><a href="enseignement_detail.php?id=<?php echo $rowEnseignement['id']; ?> "><?php echo $rowEnseignement['nom']; ?> </a> <a href="modifier_enseignement.php?id=<?php echo $rowEnseignement['id']; ?> ">Modifier</a> <a href="supprimer_option.php?id=<?php echo $rowEnseignement['id']; ?>">Supprimer</a></td>
								<td><?php echo $rowEnseignement['code']; ?></td>
								<td><?php echo $rowEnseignement['debut']; ?></td>
								<td><?php echo $rowEnseignement['fin']; ?></td>
								
								</tr>
								<?php }  ?>
								</tbody>
							   

						   </table>
						  
				   </div>
				   
			   </div>
			<?php } ?>
</div>
</div>
</div>
<?php
$i++;
}
?>
</div>
</div>
</div>

<?php
myFooter();
?>
